<%@page import="com.po.Discuss"%>
<%@page import="com.po.Substance"%>
<%@page import="com.dao.impl.DiscussDaoImpl"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'manager_root.jsp' starting page</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/vendor/linearicons/style.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/vendor/chartist/css/chartist-custom.css">
<!-- MAIN CSS -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/css/main.css">
<!-- FOR DEMO PURPOSES ONLY. You should remove this in your project -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/css/demo.css">
<!-- GOOGLE FONTS -->
<!-- ICONS -->
<link rel="apple-touch-icon" sizes="76x76"
	href="${pageContext.request.contextPath }/assets/img/apple-icon.png">
<link rel="icon" type="image/png" sizes="96x96"
	href="${pageContext.request.contextPath }/assets/img/favicon.png">
</head>
<%
	pageContext.setAttribute("pcomment", new DiscussDaoImpl()
			.findByDsid(((Substance) request.getAttribute("sub"))
					.getSid()));
%>
<body>
	<jsp:useBean id="user" class="com.dao.impl.UserDaoImpl"></jsp:useBean>
	<c:set var="roottype" value="root"></c:set>
	<c:set var="editortype" value="editor"></c:set>
	<div id="wrapper">
		<jsp:include page="top.jsp"></jsp:include>
		<c:choose>
			<c:when test="${sessionScope.Manager.utype == pageScope.roottype}">
				<jsp:include page="leftroot.jsp"></jsp:include>
			</c:when>
			<c:when test="${sessionScope.Manager.utype == pageScope.editortype}">
				<jsp:include page="lefteditor.jsp"></jsp:include>
			</c:when>
		</c:choose>
		<div class="main">
			<div class="container">
				<br> <a
					href="${pageContext.request.contextPath }/manage/skip.do?href=querysubstance.jsp"
					class="btn btn-primary btn-sm" role="button">返回</a>
				${requestScope.sub.scontent }
				<hr>
				<c:if test="${requestScope.sub.scomment == 1 }">
					<c:if test="${sessionScope.Manager.ucomment ==1 }">
				<form class="form-horizontal" role="form" action="${pageContext.request.contextPath }/manage/AddDiscussServlet.do">
							<div class="form-group">
								<label for="firstname" class="col-sm-2 control-label">评论</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="firstname"
										name="discuss">
								</div>
							</div>
							<input type="hidden" name="dsid" value="${requestScope.sub.sid }" />
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<button type="submit" class="btn btn-default">评论</button>
								</div>
							</div>
						</form>
					</c:if>
					<hr>
					<c:forEach items="${pcomment }" var="p">
						<div class="panel panel-default">
							<div class="panel-heading">
								<h3 class="panel-title">${p.dtime }</h3>
							</div>
							<div class="panel-body">${p.dcontext }</div>
						</div>
					</c:forEach>
				</c:if>
			</div>
		</div>
	</div>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/jquery/jquery.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/jquery.easy-pie-chart/jquery.easypiechart.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/chartist/js/chartist.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/scripts/klorofil-common.js"></script>

</body>
</html>
